package com.woniu.api;
import com.woniu.dto.PageDTO;
import com.woniu.dto.StockDto;
import com.woniu.param.AddDrugsParam;
import com.woniu.param.DeleteParam;
import com.woniu.param.QueryPageParam;
import com.woniu.param.StockParam;
import com.woniu.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient( value = "drugs",
        contextId = "stock",
        path = "/drugs")

@Api(tags = "药品库存接口")
public interface StockApi {
    @ApiOperation("查询药品库存")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "",
                    value = "",
                    required = false,
                    dataType = "PageDTO")
    })
    @PostMapping ("/getStock")
    Result<PageDTO<StockDto>> getStock(@RequestBody QueryPageParam queryPageParam);

    @ApiOperation("修改药品库存")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stockParam",
                    value = "修改后的药品",
                    required = false,
                    dataType = "StockParam" )
    })
    @PostMapping("/updateStock")
    Result<StockDto> updateStock(@RequestBody StockParam stockParam);



    @ApiOperation("新增药品库存")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "addDrugsParam",
                    value = "新增的药品",
                    required = false,
                    dataType = "AddDrugsParam" )
    })
    @PostMapping("/addStock")
    Result<StockDto> addStock(@RequestBody AddDrugsParam addDrugsParam);


    @ApiOperation("删除药品库存")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deleteParam",
                    value = "删除的药品",
                    required = false,
                    dataType = "DeleteParam" )
    })
    @DeleteMapping("/deleteStock")
    Result<?> deleteStock(@RequestBody DeleteParam deleteParam);
}
